﻿/**
 *  Event structure and defintions for the CLIK Button: 
 *  Valid types:
 *      PRESS - "buttonPress"
 *      CLICK - "buttonClick"
 *      DRAG_OVER - "dragOver"
 *      DRAG_OUT - "dragOut"
 *      RELEASE_OUTSIDE - "releaseOutside"
 */

/**************************************************************************

Filename    :   ButtonEvent.as

Copyright   :   Copyright 2011 Autodesk, Inc. All Rights reserved.

Use of this software is subject to the terms of the Autodesk license
agreement provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.

**************************************************************************/

package scaleform.clik.events {
    
    import flash.display.InteractiveObject;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    public class ButtonEvent extends Event {
        
    // Constants:
        public static const PRESS:String = "buttonPress";
        public static const CLICK:String = "buttonClick";
        public static const DRAG_OVER:String = "dragOver";
        public static const DRAG_OUT:String = "dragOut";
        public static const RELEASE_OUTSIDE:String = "releaseOutside";
        
    // Public Properties:
        /** The index of the controller/mouse used to generate the event (applicable only for multi-mouse cursor environments). */
        public var controllerIdx:uint = 0;
        /** The index of the button on the controller/mouse used to generate the event. */
        public var buttonIdx:uint = 0;
        /** true if the event was generated by a keyboard/gamepad; false if the event was generated by a mouse. */
        public var isKeyboard:Boolean = false;
        /** true if the event was generated by an autoRepeating button being held down; false the button is not currently repeating. */
        public var isRepeat:Boolean = false;
        
    // Protected Properties:
        
    // Initialization:
        public function ButtonEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false, 
                                    controllerIdx:uint = 0, buttonIdx:uint = 0, isKeyboard:Boolean = false,
                                    isRepeat:Boolean = false) {
            super(type, bubbles, cancelable);
            this.controllerIdx = controllerIdx;
            this.buttonIdx = buttonIdx;
            this.isKeyboard = isKeyboard;
            this.isRepeat = isRepeat;
        }
        
    // Public getter / setters:
        
    // Public Methods:
        override public function clone():Event {
            return new ButtonEvent(type, bubbles, cancelable, controllerIdx, buttonIdx, isKeyboard, isRepeat);
        }
        
        override public function toString():String {
            return formatToString("ButtonEvent", "type", "bubbles", "cancelable", "controllerIdx", "buttonIdx", "isKeyboard", "isRepeat");
        }
        
    // Protected Methods:
            }
    
}